package com.gxgeek.interrupt;

import lombok.extern.slf4j.Slf4j;

/**
 * @author gaoxing
 * @create 2017-12-22 下午2:41
 */
@Slf4j
public class InterruptDemo {

    public static void main(String[] args) throws InterruptedException {

        Thread thread = new Thread(() -> {
            try {
                    Thread.sleep(500);
            } catch (Exception e) {
                log.error("子线程出错",e.getMessage(),e);
            }finally {
                log.error("子线程死亡");
            }
        });

        thread.start();
        Thread.sleep(200);
        System.out.println(thread.isInterrupted());
        thread.interrupt();
        System.out.println(thread.isInterrupted());

    }
}
